{% load debate_tags static i18n %}

<div class="list-group border-0 card text-center text-md-left" id="sidebar" data-children=".list-group-item">

  <div class="list-group-item d-inline-block main-menu-item">
    <a href="#tlisth" data-toggle="collapse" data-parent="#sidebar" aria-expanded="false"
       class="tournament-title d-flex justify-content-between align-items-center">
      <div class="mx-auto mx-md-0 text-center">
        {% blocktrans trimmed asvar logo_alt %}
          Tabbycat Logo
        {% endblocktrans %}
        {% if on_local %}
          {% include "nav/logo_local.html" with width=18 height=18 alt=logo_alt %}
        {% else %}
          {% include "nav/logo.html" with width=18 height=18 alt=logo_alt %}
        {% endif %}
      </div>
      <div class="mb-0 d-none d-md-inline h6 mr-auto pt-1 pl-2 pr-2">
        {{ tournament }}
      </div>
      <div>
        <i data-feather="chevron-down" class="sidebar-expand d-none d-md-inline"></i>
        <i data-feather="chevron-up" class="sidebar-expand d-none d-md-inline"></i>
      </div>
    </a>
    <div class="collapse" id="tlisth">
      <a href="/" class="list-group-item" data-parent="#titleh">
        <i data-feather="home"></i>{% trans "Site Home" %}
      </a>
      <a href="{% url 'tournament-create' %}" class="list-group-item" data-parent="#titleh">
        <i data-feather="edit-2"></i>{% trans "New Tournament" %}
      </a>
      <a href="{% url 'admin:index' %}" target="_blank" class="list-group-item" data-parent="#titleh">
        <i data-feather="database"></i>{% trans "Edit Database" %}
      </a>
      {% for t in all_tournaments %}
        <div class="list-group-item tournament-areas-title" data-parent="#titleh">
          {{ t }}
        </div>
        <a href="{% url 'tournament-admin-home' tournament_slug=t.slug %}"
           class="list-group-item" data-parent="#titleh">
          <i data-feather="settings"></i>{% trans "Admin Area" %}
        </a>
        <a href="{% url 'tournament-assistant-home' tournament_slug=t.slug %}"
           class="list-group-item" data-parent="#titleh">
          <i data-feather="pocket"></i>{% trans "Assistant Area" %}
        </a>
        <a href="{% url 'tournament-public-index' tournament_slug=t.slug %}"
           class="list-group-item" data-parent="#titleh">
          <i data-feather="globe"></i>{% trans "Public Area" %}
        </a>
      {% endfor %}
    </div>
  </div>

  <div class="list-group-item d-inline-block">
    <a href="{% tournamenturl 'tournament-admin-home' %}" data-parent="#sidebar"
       class="collapsed">
      <i data-feather="monitor"></i>
      <span class="d-none d-md-inline">{% trans "Overview" %}</span>
    </a>
  </div>

  <div class="list-group-item d-inline-block">
    <a href="#setuph" data-toggle="collapse" data-parent="#sidebar" aria-expanded="false">
       <i data-feather="briefcase"></i>
       <span class="d-none d-md-inline">{% trans "Setup" %}</span>
       <i data-feather="chevron-down" class="sidebar-expand d-none d-md-inline"></i>
       <i data-feather="chevron-up" class="sidebar-expand d-none d-md-inline"></i>
    </a>
    <div class="collapse" id="setuph">
      <a href="{% tournamenturl 'options-tournament-index' %}"
         class="list-group-item" data-parent="#setuph">
        <span class="circle-icon small-circle"></span><i data-feather="settings"></i>{% trans "Configuration" %}
      </a>
      <a href="{% tournamenturl 'importer-simple-index' %}" class="list-group-item" data-parent="#setuph">
        <span class="circle-icon small-circle"></span><i data-feather="download-cloud"></i>{% trans "Import Data" %}
      </a>
      <a href="{% tournamenturl 'participants-list' %}"
         class="list-group-item" data-parent="#setuph">
        <span class="circle-icon small-circle"></span><i data-feather="book"></i>{% trans "Participants" %}
      </a>
      <a href="{% tournamenturl 'privateurls-list' %}"
         class="list-group-item" data-parent="#setuph}">
        <span class="circle-icon small-circle"></span><i data-feather="link"></i>{% trans "Private URLs" %}
      </a>
      <a href="{% tournamenturl 'notifications-status' %}"
         class="list-group-item" data-parent="#setuph">
        <span class="circle-icon small-circle"></span><i data-feather="mail"></i>{% trans "Emails" %}
      </a>
      <a href="{% tournamenturl 'panel-adjudicators-index' %}"
         class="list-group-item" data-parent="#setuph">
        <span class="circle-icon small-circle"></span><i data-feather="box"></i>{% trans "Preformed Panels" %}
      </a>
      <a href="{% tournamenturl 'exporter-xml-index' %}"
          class="list-group-item" data-parent="#setuph">
        <span class="circle-icon small-circle"></span><i data-feather="archive"></i>{% trans "Export XML" %}
      </a>
    </div>
  </div>

  {% if pref.draw_side_allocations == 'preallocated' %}
    <div class="list-group-item d-inline-block">
      <a href="{% tournamenturl 'draw-side-allocations' %}" data-parent="#sidebar"
        class="collapsed">
        <i data-feather="shuffle"></i>
        <span class="d-none d-md-inline">{% trans "Sides" %}</span>
      </a>
    </div>
  {% endif %}


  <div class="list-group-item d-inline-block">
    <a href="#checkinh" data-toggle="collapse" data-parent="#sidebar" aria-expanded="false"
       class="{% if checkins_nav %}active{% endif %}">
       <i data-feather="compass"></i>
       <span class="d-none d-md-inline">{% trans "Check-Ins" %}</span>
       <i data-feather="chevron-down" class="sidebar-expand d-none d-md-inline"></i>
       <i data-feather="chevron-up" class="sidebar-expand d-none d-md-inline"></i>
    </a>
    <div class="collapse {% if checkins_nav %}show{% endif %}" id="checkinh">
      <a href="{% tournamenturl 'admin-checkin-identifiers' %}"
         class="list-group-item {% if checkins_ids %}active{% endif %}" data-parent="#checkinh">
        <i data-feather="menu"></i>{% trans "Make Identifiers" %}
      </a>
      <a href="{% tournamenturl 'admin-checkin-prescan' %}"
         class="list-group-item {% if checkins_scans %}active{% endif %}" data-parent="#checkinh">
        <i data-feather="instagram"></i>{% trans "Scan Identifiers" %}
      </a>
      <a href="{% tournamenturl 'admin-people-statuses' %}"
         class="list-group-item {% if checkins_people_statuses %}active{% endif %}" data-parent="#checkinh">
        <i data-feather="watch"></i>{% trans "People's Status" %}
      </a>
      <a href="{% tournamenturl 'admin-venues-statuses' %}"
         class="list-group-item {% if checkins_venues_statuses %}active{% endif %}" data-parent="#checkinh">
        <i data-feather="map"></i>{% trans "Rooms' Status" %}
      </a>
    </div>
  </div>

  <div class="list-group-item d-inline-block">
    <a href="#feedh" data-toggle="collapse" data-parent="#sidebar" aria-expanded="false" class="collapsed">
      <i data-feather="message-circle"></i>
      <span class="d-none d-md-inline">{% trans "Feedback" %}</span>
      <i data-feather="chevron-down" class="sidebar-expand d-none d-md-inline"></i>
      <i data-feather="chevron-up" class="sidebar-expand d-none d-md-inline"></i>
    </a>
    <div class="collapse" id="feedh">
      <a class="list-group-item" href="{% tournamenturl 'adjfeedback-overview' %}" data-parent="#feedh">
        <i data-feather="maximize"></i>{% trans "Overview" %}
      </a>
        <a class="list-group-item" href="{% tournamenturl 'adjfeedback-view-latest' %}" data-parent="#feedh">
        <i data-feather="clock"></i>{% trans "Latest" %}
      </a>
      <a class="list-group-item" href="{% tournamenturl 'adjfeedback-view-important' %}" data-parent="#feedh">
        <i data-feather="star"></i>{% trans "Important" %}
      </a>
      <a class="list-group-item" href="{% tournamenturl 'adjfeedback-view-comments' %}" data-parent="#feedh">
        <i data-feather="message-square"></i>{% trans "Comments" %}
      </a>
      <a class="list-group-item" href="{% tournamenturl 'adjfeedback-view-by-source' %}" data-parent="#feedh">
        <i data-feather="phone-outgoing"></i>{% trans "Find by Source" %}
      </a>
      <a class="list-group-item" href="{% tournamenturl 'adjfeedback-view-by-target' %}" data-parent="#feedh">
        <i data-feather="phone-incoming"></i>{% trans "Find by Target" %}
      </a>
      <a class="list-group-item" href="{% tournamenturl 'adjfeedback-progress' %}" data-parent="#feedh">
        <i data-feather="x-circle"></i>{% trans "Unsubmitted" %}
      </a>
      <a class="list-group-item" href="{% tournamenturl 'adjfeedback-add-index' %}">
        <i data-feather="plus-circle"></i>{% trans "Add Feedback" %}
      </a>
      <a class="list-group-item" href="{% tournamenturl 'adjfeedback-update-scores-bulk' %}">
        <i data-feather="upload"></i>{% trans "Bulk Update" %}
      </a>
    </div>
  </div>

  <div class="list-group-item d-inline-block">
    <a href="#standh" data-toggle="collapse" data-parent="#sidebar" aria-expanded="false"
       data-parent="#sidebar" class="collapsed">
      <i data-feather="bar-chart-2"></i>
      <span class="d-none d-md-inline">{% trans "Standings" %}</span>
      <i data-feather="chevron-down" class="sidebar-expand d-none d-md-inline"></i>
      <i data-feather="chevron-up" class="sidebar-expand d-none d-md-inline"></i>
    </a>
    <div class="collapse" id="standh">
      <a href="{% roundurl 'standings-index' current_round %}"
         class="list-group-item" data-parent="#setuph">
        <i data-feather="maximize"></i>{% trans "Overview" %}
      </a>
      <a class="list-group-item" href="{% roundurl 'standings-team' current_round %}">
        {% if tournament.break_categories_nongeneral.count > 0 %}
          <i data-feather="users"></i>{% trans "All Teams" %}
        {% else %}
          <i data-feather="users"></i>{% trans "Teams" %}
        {% endif %}
      </a>
      {% for category in tournament.break_categories_nongeneral %}
        <a class="list-group-item {% if standings_active %}active{% endif %}" href="{% roundurl 'standings-break-category' round=current_round category=category.slug %}">
          <i data-feather="users"></i>{% blocktrans trimmed with category=category.name %}
            {{ category }} Teams
          {% endblocktrans %}
        </a>
      {% endfor %}
      <a class="list-group-item" href="{% roundurl 'standings-speaker' current_round %}">
        {% if tournament.speakercategory_set.all.count > 0 %}
          <i data-feather="user"></i>{% trans "All Speakers" %}
        {% else %}
          <i data-feather="user"></i>{% trans "Speakers" %}
        {% endif %}
      </a>
      {% for category in tournament.speakercategory_set.all %}
        <a class="list-group-item" href="{% roundurl 'standings-speaker-category' round=current_round category=category.slug %}">
          <i data-feather="user-plus"></i>{% blocktrans trimmed with category=category.name %}
            {{ category }} Speakers
          {% endblocktrans %}
        </a>
      {% endfor %}
      {% if pref.reply_scores_enabled %}
        <a class="list-group-item {% if standings_reply_nav %}active{% endif %}"
           href="{% roundurl 'standings-reply' current_round %}">
          <i data-feather="speaker"></i>{% trans "Replies" %}
        </a>
      {% endif %}
      <a class="list-group-item" href="{% tournamenturl 'motions-statistics'  %}">
        <i data-feather="crosshair"></i>{% trans "Motions" %}
      </a>
      <a class="list-group-item" href="{% roundurl 'standings-diversity' current_round %}">
        <i data-feather="globe"></i>{% trans "Diversity" %}
      </a>
    </div>
  </div>

  {% for r in tournament.rounds_for_nav %}
    {% ifchanged r.stage %}
      {% if r.stage == 'E' %}

        <div class="list-group-item d-inline-block">
          <a href="#breakh" data-toggle="collapse" data-parent="#sidebar" aria-expanded="false"
             class="collapsed">
            <i data-feather="target"></i>
            <span class="d-none d-md-inline">{% trans "Breaks" %}</span>
            <i data-feather="chevron-down" class="sidebar-expand d-none d-md-inline"></i>
            <i data-feather="chevron-up" class="sidebar-expand d-none d-md-inline"></i>
          </a>
          <div class="collapse" id="breakh">
            <a class="list-group-item" href="{% tournamenturl 'breakqual-index' %}">
              <i data-feather="maximize"></i>{% trans "Overview" %}
            </a>
            {% for category in tournament.breakcategory_set.all %}
              <a class="list-group-item" href="{% tournamenturl 'breakqual-teams' category.slug %}">
                <i data-feather="pie-chart"></i>{% blocktrans trimmed with category=category.name %}{{ category }}{% endblocktrans %}
              </a>
            {% endfor %}
            <a class="list-group-item" href="{% tournamenturl 'breakqual-adjudicators' %}">
              <i data-feather="shield"></i>{% trans "Adjudicators'" %}
            </a>
            <a class="list-group-item" href="{% tournamenturl 'break-categories-edit' %}">
              <i data-feather="pocket"></i>{% trans "Edit Categories" %}
            </a>
            <a class="list-group-item" href="{% tournamenturl 'breakqual-edit-eligibility' %}">
              <i data-feather="trello"></i>{% trans "Edit Eligibility" %}
            </a>
          </div>

        </div>

      {% endif %}
    {% endifchanged %}
    {% include 'nav/round_panel.html' %}
  {% endfor %}

  <div class="list-group-item d-inline-block">
    <a href="{% url 'logout' %}" data-parent="#sidebar"
     class="collapsed">
      <i data-feather="log-out"></i>
      <span class="d-none d-md-inline">{% trans "Log Out" %}</span>
    </a>
  </div>

</div>
